package org.dut.aoptest.Proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class JDKInvocationHandler implements InvocationHandler {
    private Object target;
    public JDKInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("我是中介，开始代理");
        Object ret = method.invoke(target, args);
        System.out.println("我是中介，结束代理");
        return ret;
    }
}
